package com.xbongbong.rollback.factory;

import com.xbongbong.paas.constant.PaasConstant;
import com.xbongbong.pro.enums.SaasMarkEnum;
import com.xbongbong.rollback.service.AbstractFormDataUpdateRollBackService;

import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 表单操作回滚工厂
 * @author 魏荣杰
 * @date 2020/12/31 16:27
 * @since
 * @version
 */
public class FormDataUpdateRollBackFactory {

    public static final Map<String, AbstractFormDataUpdateRollBackService> FORM_DATA_UPDATE_ROLL_BACK_SERVICE_MAP = new ConcurrentHashMap<>(PaasConstant.DEFAULT_INITIAL_CAPACITY);


    public static AbstractFormDataUpdateRollBackService getRollBackService(Integer businessType, Integer saasMark) {
        if (Objects.equals(SaasMarkEnum.SAAS.getCode(), saasMark)) {
            return FORM_DATA_UPDATE_ROLL_BACK_SERVICE_MAP.get(String.valueOf(businessType));
        }
        return null;
    }
}
